const {Room} = require('../model')

// 创建房间
/* 
{
    roomName:'',
    description:'',
    password:''
}
*/
exports.createRoom = async (req,res,next) =>{
    // const user = req.user
    // const creator ={
    //     _id:user._id,
    //     username:user.username,
    //     email:user.email,
    //     image:user.image,
    // }
    // const {roomname,description,image} = req.body
    // const room = new Room({
    //     creator,
    //     roomname,
    //     description,
    //     image,
    //     users:[
    //         creator
    //     ]
    // })
    // await room.save()
    // res.status(200).json({room})
    res.status(200).end()
}

// 删除房间
exports.deleteRoom = async (req,res,next) =>{
    // const {_id} = req.user
    // const {roomid} = req.query
    // const room = await Room.findById(roomid)
    // if(!room) return res.status(400).end('房间不存在')
    // if(room.creator._id.toString() !== _id.toString()) return res.status(401).end('无权限')
    // await room.remove()
    res.status(200).end('ok')
}

// 获取房间信息
exports.getRoomData = async (req,res,next) =>{
    // const {roomid} = req.query
    // const room = await Room.findById(roomid)
    // if(!room) return res.status(400).end('房间不存在')
    // res.status(200).json(room)
    res.status(200)
}


exports.getAllRoom = async (req,res,next) =>{
    
    res.status(200).json('ok')
}


exports.editRommData = async (req,res,next) =>{
    
    res.status(200).json('ok')
}


exports.joinRoom = async (req,res,next) =>{
    
    res.status(200).json('ok')
}

exports.quitRoom = async (req,res,next) =>{
    
    res.status(200).json('ok')
}